import logging

logger = logging.getLogger()


def init_log():
    logger.setLevel(logging.INFO)
    ch = logging.StreamHandler()
    fh = logging.FileHandler(filename='./server.log')
    # formatter = logging.Formatter(
    #     "%(asctime)s - %(module)s - %(funcName)s - line:%(lineno)d - %(levelname)s - %(message)s"
    # )
    # ch.setFormatter(formatter)
    # fh.setFormatter(formatter)
    logger.addHandler(ch)  # 将日志输出至屏幕
    logger.addHandler(fh)  # 将日志输出至文件


init_log()
